import { BaseModel } from './BaseModel.js';
import { dataFiles } from '../config/database.js';

const defaultDormBuildings = [
  {
    id: 1,
    name: '紫荆1号楼',
    description: '女生宿舍楼',
    genderType: 'female', // 'male' 或 'female'
    totalRooms: 50,
    createdTime: new Date().toISOString()
  },
  {
    id: 2,
    name: '银杏2号楼',
    description: '男生宿舍楼',
    genderType: 'male', // 'male' 或 'female'
    totalRooms: 60,
    createdTime: new Date().toISOString()
  }
];

export class DormBuilding extends BaseModel {
  constructor() {
    super(dataFiles.dormBuildings, defaultDormBuildings);
  }

  findByName(name) {
    return this.findOne({ name });
  }
}